package org.example.springmvc.controller;

import org.example.springmvc.model.Student;
import org.example.springmvc.service.Service;
import org.example.springmvc.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class StudentController {

//    private Student student;

//    public StudentController(Student student) {
//        this.student = student;
//    }
//    @Autowired
//    public void setStudent(Student student) {
//        this.student = student;
//    }
//    @Autowired
//    private StudentService s;
 //   private StudentService studentService;

//    public StudentController() {
//    }
//
//    public StudentController(StudentService studentService) {
//        this.studentService = studentService;
//    }
//    @Autowired
//    public void setStudentService(StudentService studentService) {
//        this.studentService = studentService;
//    }

//    public void run() {
//        System.out.println("StudentController启动");
//        studentService.run();
//        System.out.println(student);
//    }
//    @RequestMapping("/test")
//    public String ret() {
//        System.out.println(student);
//        return student.toString();
//    }
//    @Resource(name = "student1")
//    private Student student;
//
//    public void run() {
//        System.out.println(student);
//    }
    @Autowired
    private Student student;
    @RequestMapping("/readStudent")
    public String readStudent(){
        return student.toString();
    }
}


